package com.xiashitech.agent.instrumentation.context;

public class InstContext {
    private static ThreadLocal context = new ThreadLocal();

    public static <T> T getContext() {
        if (context.get() != null){
            try {
                return (T)context.get();
            } catch (Throwable e) {
                return null;
            }
        } else {
            return null;
        }
    }

    public static <T> void set(T t) {
        context.set(t);
    }

    public static void refreshCurrentThreadLocal() {
        context.set(null);
    }
}
